package cn.learn.service.system.log.impl;

import cn.learn.dao.system.log.LogDao;
import cn.learn.domain.system.log.Log;
import cn.learn.service.system.log.LogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogDao logDao;

    /**
     * 分页查找日志
     * @return
     */
    @Override
    public PageInfo selectAllByPage(int pageNum, int pageSize, String companyId) {
        PageHelper.startPage(pageNum, pageSize);
        List<Log> resultLog =  logDao.selectAll(companyId);
        PageInfo resultData = new PageInfo(resultLog);
        return resultData;
    }

    /**
     * 添加日志内容
     * @param log
     */
    @Override
    public void addOne(Log log) {
        logDao.addOne(log);
    }

}
